package babo;

public class Horse extends Thread{
	private String name;
	private int pos;
	
	public Horse(String name){
		this.name=name;
	}
	
	public void run(){
		race();
	}
	
	public void race()
	{
		for(int i=0; i < 100; i++)
		{
			pos =pos+(int)(Math.random()*100);
			System.out.println("Horse :" +name+":" +pos);
			try{
				Thread.sleep(100);
			}catch(InterruptedException e){
				e.printStackTrace();
			}
		}
	}
	
	public static void main(String[] args){
		Horse h1 = new Horse("1番目の馬");
		Horse h2 = new Horse("2番目の馬");
		Horse h3 = new Horse("3番目の馬");
		h1.start();
		h2.start();
		h3.start();
		
		
	}
}
